package com.zmn.oms.common.utils;

import java.math.BigDecimal;

/**
 * 类描述：配件相关的金额计算工具
 *
 * @author wangxiaokun
 * @since 2020/9/23 11:28
 */
public class MathUtil {

    /**
     * 单价乘以数量，返回Integer类型金额
     * @param amount 
     * @param number 
     * @return java.lang.Integer
     * @author wangxiaokun
     */
    public static Integer amountMultiplyNumber(Integer amount, BigDecimal number){
        BigDecimal b1 = new BigDecimal(amount);
        return b1.multiply(number).intValue();
    }

    /**
     * 单价乘以数量，返回Integer类型金额
     * @param amount
     * @param number
     * @return java.lang.Integer
     * @author wangxiaokun
     */
    public static Integer amountMultiplyNumber2(Integer amount, BigDecimal number){
        BigDecimal b1 = new BigDecimal(amount);
        return b1.multiply(number).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
    }

}
